﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Users.aspx.cs" Inherits="FreeLancer.HRB.WebApp.Admin.Pages.Users" Title="<%$ Resources:labels, users %>" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <br />
  <div class="settings">
      <h1>
          <%=Resources.labels.createNewUser %>
      </h1>
      <br />
      <asp:CreateUserWizard ID="CreateUserWizard" runat="server" 
        LoginCreatedUser="false" 
        UserNameLabelText="<%$ Resources:labels, username %>"
        PasswordLabelText="<%$ Resources:labels, password %>"
        ConfirmPasswordLabelText="<%$ Resources:labels, confirmPassword %>"
        EmailLabelText="<%$ Resources:labels, email %>"
        UserNameRequiredErrorMessage="<%$ Resources:labels, usernameReqMsg %>"
        PasswordRequiredErrorMessage="<%$ Resources:labels, passwordReqMsg %>"
        ConfirmPasswordRequiredErrorMessage="<%$ Resources:labels, confirmPwdReqMsg %>"
        EmailRequiredErrorMessage="<%$ Resources:labels, emailReqMsg %>"
        ConfirmPasswordCompareErrorMessage="<%$ Resources:labels, confirmPwdCompareErrMsg %>"
        UnknownErrorMessage="<%$ Resources:labels, createUserError %>"
        InvalidPasswordErrorMessage="<%$ Resources:labels, passwordInvalidMsg %>"
        InvalidEmailErrorMessage="<%$ Resources:labels, emailInvalidMsg %>"
        CompleteSuccessText="<%$ Resources:labels, createUserSuccessfully %>"
        CreateUserButtonText="<%$ Resources:labels, createUser %>"
        EmailRegularExpression="[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"
        EmailRegularExpressionErrorMessage="<%$ Resources:labels, emailInvalidMsg %>"
        >
          <WizardSteps>
              <asp:CreateUserWizardStep ID="CreateUserWizardStep" runat="server" Title=""/>
          </WizardSteps>
      </asp:CreateUserWizard>
      <asp:Label runat="server" ID="lblError" Text="<%$ Resources:labels, existedUsername %>" style="color:Red" visible="false" />
      <asp:Label runat="server" ID="lblErrorInvalidPassword" 
        Text="<%$ Resources:labels, passwordInvalidMsg %>" style="color:Red" visible="false" />
      <asp:Label runat="server" ID="lblInfo" 
        Text="<%$ Resources:labels, createUserSuccessfully %>" style="color:Blue" visible="false" />
  </div>
  <br />
  <div class="settings">
    <dxwgv:ASPxGridView ID="ASPxGridViewUser" runat="server" 
        AutoGenerateColumns="False" KeyFieldName="UserID"
        SettingsEditing-Mode="Inline" 
        SettingsPager-Visible="true" 
        SettingsBehavior-ConfirmDelete="true"
        SettingsText-CommandCancel="<%$ Resources:labels, cmdCancel %>"
        SettingsText-ConfirmDelete="<%$ Resources:labels, cmdConfirmDelete %>"
        SettingsText-CommandUpdate="<%$ Resources:labels, cmdUpdate %>"
        OnRowDeleting="ASPxGridViewUser_OnDeleting"
        OnRowUpdating="ASPxGridViewUser_OnUpdating"
        OnCellEditorInitialize="ASPxGridViewUser_OnCellEditorInitialize">
      <Settings ShowFilterRow="True"/>
      <Columns>
        <dxwgv:GridViewCommandColumn VisibleIndex="0" Width="100px">
          <EditButton Visible="True" Text="<%$ Resources:labels, cmdEdit %>">
          </EditButton>
          <DeleteButton Visible="True" Text="<%$ Resources:labels, cmdDelete %>">
          </DeleteButton>
          <ClearFilterButton Visible="True" Text="<%$ Resources:labels, cmdClearFilter %>">
          </ClearFilterButton>
          <CancelButton Text="<%$ Resources:labels, cmdCancel %>">
          </CancelButton>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewCommandColumn>
        <dxwgv:GridViewDataTextColumn Caption="ID" FieldName="UserID" Visible="false">
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, colUsername %>" 
          FieldName="UserName" VisibleIndex="1" Width="250px" ReadOnly="true">
          <%--<PropertiesTextEdit>
            <ValidationSettings>
              <RequiredField ErrorText="<%$ Resources:labels, usernameReqMsg %>" IsRequired="True" />
            </ValidationSettings>
          </PropertiesTextEdit>--%>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataTextColumn>
        <%--<dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, colPassword %>" 
          FieldName="Password" VisibleIndex="2" Width="100px"
          PropertiesTextEdit-DisplayFormatString="********">
          <PropertiesTextEdit Password="True">
            <ValidationSettings>
              <RequiredField ErrorText="<%$ Resources:labels, passwordReqMsg %>" IsRequired="True" />
            </ValidationSettings>
          </PropertiesTextEdit>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataTextColumn>--%>
        <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, colEmail %>" 
          FieldName="EmailAddress" VisibleIndex="3" Width="200px">
          <PropertiesTextEdit>
            <ValidationSettings ErrorText="">
              <RegularExpression ErrorText="<%$ Resources:labels, emailInvalidMsg %>" 
                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
              <RequiredField ErrorText="<%$ Resources:labels, emailReqMsg %>" IsRequired="True"/>
            </ValidationSettings>
          </PropertiesTextEdit>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataCheckColumn Caption="<%$ Resources:labels, colAdminName %>" 
          VisibleIndex="4" Width="100px" FieldName="IsAdministrators">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataCheckColumn>
        <dxwgv:GridViewDataCheckColumn Caption="<%$ Resources:labels, colSpecialistName %>" 
          VisibleIndex="5" Width="100px" FieldName="IsSpecialists">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataCheckColumn>
        <%--<dxwgv:GridViewDataComboBoxColumn Caption="<%$ Resources:labels, colRole %>" 
          VisibleIndex="4" Width="150px">
          <PropertiesComboBox TextField="Role" ValueField="RoleID">
          </PropertiesComboBox>
        </dxwgv:GridViewDataComboBoxColumn>--%>
      </Columns>
      <SettingsPager Summary-Visible="true" AlwaysShowPager="true" Mode="ShowAllRecords">
        <Summary AllPagesText="<%$ Resources:labels, usersAllPagesText %>" Text="<%$ Resources:labels, usersPageText %>" />
      </SettingsPager>
    </dxwgv:ASPxGridView>
  </div>
</asp:Content>
